package com.cm.common.core;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @类 名：Result </br>
 * @描 述：</br>
 * @日 期：2020/9/2 23:26</br>
 * @作 者：常明</br>
 * @版 本：1.0.0
 * @since JDK 1.8
 */
@Data
@AllArgsConstructor
public class Result<T> {
    static String SUCCESS_CODE="1111";
    static String ERROR_CODE="0000";
    private String code;
    private T data;
    private String msg="ok";
    private Result(){}
    public static Result success(){
        return new Result<>(SUCCESS_CODE,"11","ok");
    }
    public static Result error(){
        return new Result<>(ERROR_CODE,false,"系统错误");
    }
    public static Result error(String message){
        return new Result<>(ERROR_CODE,false,message);
    }
}
